package com.trhui.mallbook.client;

import com.trhui.mallbook.domain.common.ApiRequest;
import com.trhui.mallbook.domain.common.BaseResponse;
import com.trhui.mallbook.domain.request.hf.HfDepositRequest;
import com.trhui.mallbook.domain.request.yb.YbDepositRequest;
import com.trhui.mallbook.domain.response.hf.HfDepositResponse;
import com.trhui.mallbook.domain.response.yb.YbDepositResponse;
import com.trhui.mallbook.enums.ChannelTypeEnum;
import com.trhui.mallbook.enums.ServerCodeEnum;

/**
 * 充值接口
 *
 * @Author xgc
 * @Date 2023/08/18 16:53
 **/
public class DepositClient extends AbstractClient {

    /**
     * 汇付充值接口
     *
     * @param request 汇付充值请求对象
     * @return
     */
    public static BaseResponse<HfDepositResponse> hfDeposit(HfDepositRequest request) {
        ApiRequest apiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.DEPOSIT)
                .channelType(ChannelTypeEnum.HF)
                .build();
        return post(apiRequest, HfDepositResponse.class);
    }

    /**
     * 易宝充值接口
     *
     * @param request 易宝充值请求对象
     * @return
     */
    public static BaseResponse<YbDepositResponse> ybDeposit(YbDepositRequest request) {
        ApiRequest apiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.DEPOSIT)
                .channelType(ChannelTypeEnum.YB)
                .build();
        return post(apiRequest, YbDepositResponse.class);
    }

}
